import request from "@/utils/request";

export function getRequisitions(paramters) {
  return request({
    url: "api/v1/payment-requisitions",
    method: "get",
    params: paramters,
    financeServer: true,
  });
}

export function getRequisition(id) {
  return request({
    url: "api/v1/payment-requisitions/" + id,
    method: "get",
    financeServer: true,
  });
}

export function addRequisition(data) {
  return request({
    url: "api/v1/payment-requisitions",
    method: "post",
    data: data,
    financeServer: true,
  });
}

export function updateRequisition(data) {
  return request({
    url: "api/v1/payment-requisitions",
    method: "put",
    data: data,
    financeServer: true,
  });
}

export function updateRequisitionStatus(id, status) {
  return request({
    url: "api/v1/payment-requisitions/" + id + "/status/" + status,
    method: "put",
    data: {},
    financeServer: true,
  });
}

export function deleteRequisition(id) {
  return request({
    url: "api/v1/payment-requisitions/" + id,
    method: "delete",
    financeServer: true,
  });
}

export function pushPayment(id) {
  return request({
    url: "api/v1/payment-requisitions/" + id + "/payments",
    method: "post",
    financeServer: true,
  });
}

export function updateStatus(id , status) {
  return request({
    url: "api/v1/payment-requisitions/" + id + "/status/"+status,
    method: "put",
    financeServer: true,
  });
}
